package com.botann.projects.model;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * cs_erp
 * Role
 * Created by 刘山国 on 2018/9/28.
 * Copyright (c) 2017 伯坦科技. All rights reserved
 */
@Entity
public class Role {
    private int id;
    private String name;
    private int rank;
    private String authority;
    private boolean del;

    @Id
    @Column(name = "id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name", nullable = false, length = 80)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "rank", nullable = false)
    public int getRank() {
        return rank;
    }

    public void setRank(int rank) {
        this.rank = rank;
    }

    @Basic
    @Column(name = "authority", nullable = false, length = 255)
    public String getAuthority() {
        return authority;
    }

    public void setAuthority(String authority) {
        this.authority = authority;
    }

    @Basic
    @Column(name = "del", nullable = false)
    public boolean isDel() {
        return del;
    }

    public void setDel(boolean del) {
        this.del = del;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Role role = (Role) o;

        if (id != role.id) return false;
        if (rank != role.rank) return false;
        if (del != role.del) return false;
        if (name != null ? !name.equals(role.name) : role.name != null) return false;
        if (authority != null ? !authority.equals(role.authority) : role.authority != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + rank;
        result = 31 * result + (authority != null ? authority.hashCode() : 0);
        result = 31 * result + (del ? 1 : 0);
        return result;
    }
}
